<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>NodeIterator</title>
</head>
<body>
    <div id="div1">
        <p>hello</p>
        <strong>dom</strong>
        <p>NodeIterator</p>
        <ul>
            <li>createNodeIterator</li>
            <li>nextNode</li>
            <li>previousNode</li>
        </ul>
    </div>
    <script>
        var div = document.getElementById('div1');

        var filter = function(node)
        {
            return node.tagName.toLowerCase() == "li"?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;
        };

        var iterator = document.createNodeIterator(div,NodeFilter.SHOW_ELEMENT,filter,false);
        var node = iterator.nextNode();
        while(node !== null)
        {
            console.log(node);
            node = iterator.nextNode();
        }
    </script>
</body>
</html>